#include "../include/timer.h"

Timer::Timer(long _limit) {
	time(&start);
	limit = _limit;
}

Timer::Timer() {
	time(&start);
}

bool Timer::isExpired() {
	return elapsed() >= limit;
}

long Timer::elapsed() {
	time_t now;
	time(&now);
	return now.usec - start.usec;
}

void Timer::reset() {
	time(&start);
}
